<!doctype html>
<html class="no-js">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="description" content="">
    <meta name="keywords" content="">
    <meta name="viewport"
          content="width=device-width, initial-scale=1">
    <title>tweet 后台管理</title>

    <!-- Set render engine for 360 browser -->
    <meta name="renderer" content="webkit">

    <!-- No Baidu Siteapp-->
    <meta http-equiv="Cache-Control" content="no-siteapp"/>

    <link rel="icon" type="image/png" href="../assets/i/favicon.png">

    <!-- Add to homescreen for Chrome on Android -->
    <meta name="mobile-web-app-capable" content="yes">
    <link rel="icon" sizes="192x192" href="../assets/i/app-icon72x72@2x.png">

    <!-- Add to homescreen for Safari on iOS -->
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <meta name="apple-mobile-web-app-title" content="Amaze UI"/>
    <link rel="apple-touch-icon-precomposed" href="../assets/i/app-icon72x72@2x.png">

    <!-- Tile icon for Win8 (144x144 + tile color) -->
    <meta name="msapplication-TileImage" content="assets/i/app-icon72x72@2x.png">
    <meta name="msapplication-TileColor" content="#0e90d2">

    <link rel="stylesheet" href="../assets/css/amazeui.min.css">
    <link rel="stylesheet" href="../assets/css/app.css">

    <!--在这里编写你的代码-->

    <!--[if (gte IE 9)|!(IE)]><!-->
    <script src="../js/jquery2.js"></script>
    <!--<![endif]-->
    <!--[if lte IE 8 ]>
    <script src="http://libs.baidu.com/jquery/1.11.3/jquery.min.js"></script>
    <script src="http://cdn.staticfile.org/modernizr/2.8.3/modernizr.js"></script>
    <script src="../assets/js/amazeui.ie8polyfill.min.js"></script>
    <![endif]-->
    <script src="../assets/js/amazeui.min.js"></script>
    <script src="../js/vue.js"></script>
    <!--    弹框-->
    <link rel="stylesheet" type="text/css" href="../swal/sweetalert2.min.css">
    <script src="../swal/sweetalert2.min.js"></script>
</head>

<body>
<div id="tmeplate" style="display: none;">
    <div class="am-form am-form-horizontal">
        <div class="am-form-group">
            <label for="doc-ipt-3" class="am-u-sm-2 am-form-label">账号</label>
            <div class="am-u-sm-10">
                <input type="text" class="user" placeholder="输入你的账号">
            </div>
        </div>

        <div class="am-form-group">
            <label for="doc-ipt-pwd-2" class="am-u-sm-2 am-form-label">密码</label>
            <div class="am-u-sm-10">
                <input type="password" class="password" placeholder="输入你的密码">
            </div>
        </div>
    </div>
</div>


</body>
<script type="text/javascript">
    var template=document.getElementById('tmeplate').innerHTML;
    function createSwal() {
        swal({
            title: '管理员登录',
            html:template,
        }).then(function () {
            var id=$(".user")[1].value;
            var password=$(".password")[1].value;
            $.post('../manager',{
                type:'login',
                username:id,
                password:password
            },function (response) {
                console.log(response)
                if (response == "success"){
                    swal({
                        title:'您好！'+id,
                        text:'欢迎登录后台管理,您可以为所欲为了',
                        type:'success',
                        confirmButtonText: '跳转到主页'
                    }).then(function () {
                        localStorage.setItem("weibo_managername",id);
                        location.href="./data.html";
                    });
                }else{
                    swal(
                        '登陆失败！',
                        '抱歉您登录不成功，没办法为所欲为!',
                        'error'
                    ).then(function () {
                        window.createSwal();
                    })
                }
            });
        })
    }
    createSwal();
</script>
</html>